<%@ page language="java" contentType="text/html; charset=utf-8"
	import="com.hykj.dao.*,com.hykj.valuebean.*,java.util.List,java.util.ArrayList,java.util.Iterator"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>

<html>
<head>
<link rel="stylesheet" type="text/css" href="/hykj/css/header.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>首页产品</title>
<script type="text/javascript">
function changeUrl() {
	
	var x = document.getElementsByName("products");
	var url = "";
	var ur = "";
	for (i = 0; i < x.length; i++) {
		if (x[i].checked) {
			url += (x[i].value +",");
		}
		ur = url.substring(0,(url.lastIndexOf(",")));
	}
	document.getElementById("delete").action="/hykj/admin/products/deleteProduct?productId=(" + ur + ")";
	
}

function deleteProducts() {
	document.getElementById("delete").submit();
}
</script>
</head>
<body>
	<center>	
	<jsp:include page = "/admin/head.jsp">
	<jsp:param name="menu" value="products"></jsp:param></jsp:include>
	<table width = "944" border="0">
		<tr>
			<td align="left" width="655" bgcolor="white">
		<table width="655" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td>
					<a href="/hykj/admin/products/shouye.jsp">首页产品</a>
				</td>
				<td><a
					href="/hykj/admin/products/insertProducts.jsp">新增</a><br></br>
				</td>
				<td align="right"><input type="button"
					onclick="deleteProducts()" value="删除"></input></td>
			</tr>
			<tr height="30">
				<td colspan="3" width="655" align="left" valign="top">
				<form id="delete" name="deleteform" action="" method="post">
				<table>
				<tr>
				<td align="left">
				
				<%!productsDao productsDaoIns = new productsDao();
	products productsIns = new products();
	String cruP = "";
	String cruG = "";
	%> <%
	List<?> productslist = productsDaoIns.getProducts("8");
 	
 	Iterator<?> iter = productslist.iterator();
 	int f = 1;
 	while (iter.hasNext()) {

 		productsIns = (products) iter.next();
 	%><%=f%>
 	<input onclick="changeUrl()" type="checkbox" name="products" value=<%=productsIns.getId()%> />
 <a target="_blank"  href="/hykj/admin/products/viewProduct?productId=<%=productsIns.getId()%>"><%=productsIns.getTitle()%></a><br />&nbsp;
<%=productsIns.getDescribes() %> <br />
				<%
				f++;
					}
				%>
				</td>
				</tr>
				</table>
				</form>
				</td>
			</tr>
		</table>
			</td>
			<td valign="top">
				<table width="280" border="0" cellpadding="0" cellspacing="0">
					<tr>
				<td height="5"></td>
			</tr>
			<tr>
				<td width="280" height="42"
					background="/hykj/images/gamePlatform.gif"></td>
			</tr>
			<tr>
				<td align="left" width="280"
					background="/hykj/images/modNews_center.gif">
					&nbsp;&nbsp;&nbsp;&nbsp;<a
					href="/hykj/admin/products/getCategoryProducts?category=0">java</a><br />
				&nbsp;&nbsp;&nbsp;&nbsp;<a
					href="/hykj/admin/products/getCategoryProducts?category=1">Symbian</a><br />
				&nbsp;&nbsp;&nbsp;&nbsp;<a
					href="/hykj/admin/products/getCategoryProducts?category=2">iPhone</a><br />
				&nbsp;&nbsp;&nbsp;&nbsp;<a
					href="/hykj/admin/products/getCategoryProducts?category=3">Android</a><br />
				</td>
			</tr>
			<tr>
				<td width="280" height="14"
					background="/hykj/images/modNews_btm.gif"></td>
			</tr>
				</table>
			</td>
		</tr>
	</table>
	
	
	
<jsp:include page = "/admin/foot.jsp" />
	</center>
</body>
</html>